<?php

  //to do: improve the way to pass two or more parameters in the paged-table ( link )
    
  $aux = explode ( '|', $_GET['id'] );
  $index=0;
  $DistrictUid = str_replace ( '"', '', $aux[$index++] );

  require_once ( PATH_PLUGINS . 'hr' . PATH_SEP . 'class.hr.php');
  $pluginObj = new hrClass ();

  require_once ( "classes/model/HrDistricts.php" );
  //if exists the row in the database propel will update it, otherwise will insert.
  $tr = HrDistrictsPeer::retrieveByPK( $DistrictUid  );
  
  if ( ( is_object ( $tr ) &&  get_class ($tr) == 'HrDistricts' ) ) { 
     $fields['DISTRICT_UID'] = $tr->getDistrictUid();
     $fields['LABEL_DISTRICT_UID'] = $tr->getDistrictUid();
     $fields['DISTRICTSTATE_ID'] = $tr->getDistrictstateId();
     $fields['LABEL_DISTRICTSTATE_ID'] = $tr->getDistrictstateId();
     $fields['DISTRICTNAME'] = $tr->getDistrictname();
     $fields['LABEL_DISTRICTNAME'] = $tr->getDistrictname();
     $fields['DISTRICTADDRESS1'] = $tr->getDistrictaddress1();
     $fields['LABEL_DISTRICTADDRESS1'] = $tr->getDistrictaddress1();
     $fields['DISTRICTADDRESS2'] = $tr->getDistrictaddress2();
     $fields['LABEL_DISTRICTADDRESS2'] = $tr->getDistrictaddress2();
     $fields['DISTRICTCITY'] = $tr->getDistrictcity();
     $fields['LABEL_DISTRICTCITY'] = $tr->getDistrictcity();
     $fields['DISTRICTCOUNTY'] = $tr->getDistrictcounty();
     $fields['LABEL_DISTRICTCOUNTY'] = $tr->getDistrictcounty();
     $fields['DISTRICTZIPCODE'] = $tr->getDistrictzipcode();
     $fields['LABEL_DISTRICTZIPCODE'] = $tr->getDistrictzipcode();
     $fields['DISTRICTPHONE'] = $tr->getDistrictphone();
     $fields['LABEL_DISTRICTPHONE'] = $tr->getDistrictphone();
     $fields['DISTRICTFAX'] = $tr->getDistrictfax();
     $fields['LABEL_DISTRICTFAX'] = $tr->getDistrictfax();
     $fields['DISTRICTWEBSITE'] = $tr->getDistrictwebsite();
     $fields['LABEL_DISTRICTWEBSITE'] = $tr->getDistrictwebsite();
     $fields['SERSDISTRICTCODE'] = $tr->getSersdistrictcode();
     $fields['LABEL_SERSDISTRICTCODE'] = $tr->getSersdistrictcode();
     $fields['STRSDISTRICTCODE'] = $tr->getStrsdistrictcode();
     $fields['LABEL_STRSDISTRICTCODE'] = $tr->getStrsdistrictcode();
     $fields['STATEIDNUMBER'] = $tr->getStateidnumber();
     $fields['LABEL_STATEIDNUMBER'] = $tr->getStateidnumber();
     $fields['FEDERALIDNUMBER'] = $tr->getFederalidnumber();
     $fields['LABEL_FEDERALIDNUMBER'] = $tr->getFederalidnumber();
     $fields['ODJPSNUMBER'] = $tr->getOdjpsnumber();
     $fields['LABEL_ODJPSNUMBER'] = $tr->getOdjpsnumber();
  }
  else
    $fields = array();  
  
  $G_MAIN_MENU = 'processmaker';
  $G_SUB_MENU = 'hr/menuhrDistricts';
  $G_ID_MENU_SELECTED = 'ID_HR_DIS';
  $G_ID_SUB_MENU_SELECTED = 'ID_HR_DISTRICTS';


  $G_PUBLISH = new Publisher;
  $G_PUBLISH->AddContent('xmlform', 'xmlform', 'hr/hrDistrictsDelete', '', $fields, 'hrDistrictsDeleteExec' );
  G::RenderPage('publish', 'blank');   
?>